-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add tables property to base model class #502
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DirkEilander
requested changes
Sep 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR @savente93! A couple of comments to discuss
- You deviated from the approach of other model properties by not implementing a dynamic (not sure this is the right terminology) public
tables
property and initiating the internal_tables
property with None. Using a dynamictables
property allows to trigger reading upon first call (i.e. when the _tables property is still None; this should also be changed). See e.g.Model.maps
property. - You also implemented a different get methods and an iter methods which we don't have for other properties. I think we can keep those but these should point to the
tables
instead of_tables
property to trigger the reading. - I'm also not sure if we need to support different drivers in the read and write methods here. Most models will probably use a custom format and hence overwrite the read and write methods. Thus writing to different table formats like excel and/or parquet will likely not be used. I suggest to limit it to a single csv format similar to the other properties to keep thinks simple on our side.
DirkEilander
approved these changes
Sep 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made some final changes to
- make the method between properties more consistent, i.e., order of arguments in set_tables; usage of single
set_tables
method rather than singular and plural; and fn argument in read and write. - add tables to default read and write components all (sub)model classes.
- added tables to append test
@DirkEilander Thanks for fixing the tests :) |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue addressed
Fixes #377
Explanation
Copied and extended the code from Wflow as referenced in the issue. It seemed like a good idea to support more file types than just csv, so I implemented so common ones, but others can easily be added if necessary.
Checklist
main
Additional Notes (optional)
Add any additional notes or information that may be helpful.